/*
 ***************************************************************************
 *           Copyright © 2009 by konglinglong                              *
 *           konglinglong@gmail.com                                        *
 *           我的主页:https://sites.google.com/site/konglinglong/           *
 ***************************************************************************
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************
 */

#ifndef USERINFO_H
#define USERINFO_H

#include <string>
#include <vector>
#include "Signature.h"


class LongUser
{
public:
	//登陆状态
	enum UserStatus {online = 0x0A,		//在线
					offline = 0x14,		//离线
					away = 0x1E,		//离开
					invisible = 0x28,	//隐身
					busy = 0x32,		//忙碌
					quiet = 0x46		//静音
					};
	//用户信息索引
	enum Info_Index{Info_qqID,       Info_nick,     Info_country,  Info_province,  Info_zipcode,
					Info_address,    Info_telephone, Info_age,      Info_gender,    Info_name,
					Info_email,      Info_pagerSn,   Info_pagerNum, Info_pagerSp,   Info_pagerBaseNum,
					Info_pagerType,  Info_occupation,Info_homepage, Info_authType,  Info_unknown1,
					Info_unknown2,   Info_face,      Info_mobile,   Info_mobileType,Info_intro,
					Info_city,       Info_unknown3,  Info_unknown4, Info_unknown5,  Info_openHp,
					Info_openContact,Info_college,   Info_horoscope,Info_zodiac,    Info_blood,
					Info_qqShow,     Info_unknown6  };
	LongUser();

	~LongUser();
	//
	void init();
	//设置登陆状态
	void setLoginMode(const UserStatus sta);
	//获取登陆状态
	UserStatus getLoginMode();
	//设置当前状态
	void setCurrentStatus(const UserStatus sta);
	//获取当前状态
	UserStatus getCurrentStatus();
	//
	void putData(const unsigned char *buf, const int len);
	//
	const std::string &at(const Info_Index index) const;

public:
	//用户的签名信息
	Signature signature;

private:
	//我的QQ号码
	unsigned int qqNum;
	//登陆模式
	UserStatus loginMode;
	//当前状态，如登陆成功后online，掉线后offline
	UserStatus currentStatus;

    //用户信息队列
	std::vector<std::string> infoList;
	//每项信息分割标志
	static const unsigned char DIVIDER = 0x1E;
	//共37个部分信息
	static const unsigned int QQ_CONTACT_FIELDS = 37;

};

#endif // USERINFO_H
